package com.livenativern.module;
/*
 *  @创建者    lihaijun
 *  @创建时间   2018/5/2 16:09
 *  @描述     ${TODO}
 *
 *  @更新者    $Author
 *  @更新时间   $Date
 *  @更新描述   ${TODO}
 */

import android.content.Context;

import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.livenativern.utils.SpUtils;

public class TokenModule extends ReactContextBaseJavaModule {
    public static final String REACT_CLASS = "TokenModule";

    public Context mContext;
    public TokenModule(ReactApplicationContext reactContext) {
        super(reactContext);
        this.mContext = reactContext;
    }

    @Override
    public String getName() {
        return REACT_CLASS;
    }

    @ReactMethod
    public void saveToken(String token) {
        SpUtils.setToken(mContext,token);
    }

    @ReactMethod
    public void handleCallback(String msg, Callback callback) {
        callback.invoke(msg);
    }
}
